function $(selector){
	var result = document.querySelectorAll(selector);
	if(result.length === 1){
		return result[0]
	}
	return result;
}
function test(msg){
        var lvl=0;
        if(msg.match(/^[0-9]{6}$/)){
            lvl++
        }
        if(msg.match(/[^a-zA-Z]/)){
            lvl++
        }
        if(msg.match(/[^0-9a-zA-Z]/)){
            lvl++
        }
       
        // if(msg.length<6){
        //     lvl--
        // }
        return lvl
    }
  
    window.onload=function(){
        var test1=document.getElementsByClassName("test1")
        console.log(test1)
        $("#userpass").onkeyup=function(){
            // console.log($("#userpass"))
              var total=test(this.value)
            for(var i=0;i<test1.length;i++){
                test1[i].style.backgroundColor="gray"
        
            }
            if(this.value.length>=6){
              
               console.log(total)
               if(total==2){
                test1[0].style.backgroundColor="green"
                // test1[1].style.backgroundColor="gray"
                // test1[2].style.backgroundColor="green"
                
            }
                if(total==0){
                    test1[1].style.backgroundColor="green"
        
                }
                if(total==1){
                    // test1[0].style.backgroundColor="gray"
                    test1[2].style.backgroundColor="green"
           
                }
                
            }
        }
        }